package override;

public class Student {
    public String name;
    public int score;
    public int id;

    public Student(String name, int score, int id) {
        this.name = name;
        this.score = score;
        this.id = id;
    }

    public Student(String name, int score) {
        this.name = name;
        this.score = score;
    }

    // 重写的 toString
    public String toString() {
        return "姓名：" + this.name + "，成绩：" + this.score;
    }

    // 重写的 equals 按 id 去对比
    public boolean equals(Student obj) {
        if (this.id == obj.id) {
            return true;
        } else {
            return false;
        }
    }
}
